﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Motoball.screenmanager;

namespace Motoball
{
    public class DiffBloomModel:BasicModel
    {
        public DiffBloomModel(Model model)
            : base(model)
        {
            bloomingMeshes = new Dictionary<string, string>(model.Meshes.Count);           
            foreach (ModelMesh mesh in model.Meshes)
            {
                bloomingMeshes.Add(mesh.Name, "default");
            }
            
        }
        public Dictionary<string, string> bloomingMeshes;
        public bool blooming = false;
        public override void Draw(Camera camera)
        {
            model.Root.Transform = World;
            model.CopyAbsoluteBoneTransformsTo(transforms);
            foreach (ModelMesh mesh in model.Meshes)
            {
                if (bloomingMeshes[mesh.Name] == GameScreen.screenManager.currentDrawSetId)
                {
                    foreach (BasicEffect be in mesh.Effects)
                    {
                        be.GraphicsDevice.RenderState.DepthBufferEnable = true;
                        //be.EnableDefaultLighting();
                        be.Projection = camera.projection;
                        be.View = camera.view;
                        be.World = transforms[mesh.ParentBone.Index];
                    }
                    mesh.Draw();
                }
            }
        }
       
    }


}
